﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Globalization;

namespace ZhimeiSoft.Framework.Client.Control.DateTimeGrid
{


    public partial class MonthDateTimeForDay : UserControl, IDateTimeView
    {
        /// <summary>
        /// 当前的时间
        /// </summary>
        private DateTime _dateTime = new DateTime();

        public MonthDateTimeForDay()
        {
            InitializeComponent();
        }


        #region IDateTimeView 成员

        public DateTime getDateTime()
        {
            return _dateTime;
        }

        public void setDateTime(DateTime dateTime)
        {
            _dateTime = new DateTime(dateTime.Ticks);
            string textMonth = string.Concat(dateTime.Month, '月');
            if(dateTime.Day != 1)
                textMonth = "";

            labelMonth.Text = string.Concat(textMonth, dateTime.Day, '日');
            labelChineseMonth.Text = ChineseDateTime.GetChineseDateTime(dateTime);
        }

        public void setEffectiveColor(bool bEffective){
            if(bEffective)
                checkedListBoxControl.BackColor = System.Drawing.SystemColors.Window;
        }


        public void addItem(string valueList)
        {
            checkedListBoxControl.Items.Add(valueList);
        }

        public int getItemID()
        {
            return checkedListBoxControl.SelectedIndex;
        }

        public void delItem(int indexID)
        {
            if (indexID == -1)
                return;
            checkedListBoxControl.Items.RemoveAt(indexID);
        }

        public void initDate(DateTime dtInit)
        {
            checkedListBoxControl.BackColor = System.Drawing.SystemColors.InactiveCaption;
            labelMonth.Text = "日期";
            labelChineseMonth.Text = "农历";
        }

        #endregion
    }
}
